package com.feather.unit;

import java.util.regex.Pattern;

import com.feather.annotation.ActionMethod;
import com.feather.annotation.InputParam;

public class StringActionUnit {
	
	@ActionMethod
	public Object replace(
			@InputParam(name="str") String str,
			@InputParam(name="oldChar") String oldChar,
			@InputParam(name="newChar") String newChar)
	{
		return str.replace(oldChar, newChar);
	}
	
	@ActionMethod
	public Object regexReplace(
			@InputParam(name="str") String str,
			@InputParam(name="pattern") String pattern,
			@InputParam(name="replacement") String replacement)
	{
		return Pattern.compile(pattern).matcher(str).replaceAll(replacement);
	}
}
